#include <wx/colordlg.h>
#include "wxssettings.h"
#include "wxwidgets/wxssizer.h"
#include "wxwidgets/wxsitemeditor.h"
#include <prep.h>
#include <wx/intl.h>
#include <wx/string.h>

const long wxsSettings::ID_CHECKBOX11 = wxNewId();
const long wxsSettings::ID_CHOICE2 = wxNewId();
const long wxsSettings::ID_COMBOBOX1 = wxNewId();
const long wxsSettings::ID_BUTTON1 = wxNewId();
const long wxsSettings::ID_BUTTON2 = wxNewId();
const long wxsSettings::ID_CHECKBOX7 = wxNewId();
const long wxsSettings::ID_SPINCTRL1 = wxNewId();
const long wxsSettings::ID_CHECKBOX9 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON1 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON2 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON3 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON4 = wxNewId();
const long wxsSettings::ID_SPINCTRL2 = wxNewId();
const long wxsSettings::ID_CHECKBOX1 = wxNewId();
const long wxsSettings::ID_CHECKBOX2 = wxNewId();
const long wxsSettings::ID_CHECKBOX3 = wxNewId();
const long wxsSettings::ID_CHECKBOX4 = wxNewId();
const long wxsSettings::ID_CHECKBOX5 = wxNewId();
const long wxsSettings::ID_CHECKBOX6 = wxNewId();
const long wxsSettings::ID_CHOICE1 = wxNewId();
const long wxsSettings::ID_SPINCTRL3 = wxNewId();
const long wxsSettings::ID_CHECKBOX8 = wxNewId();
const long wxsSettings::ID_CHECKBOX10 = wxNewId();
const long wxsSettings::ID_CHECKBOX12 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON5 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON6 = wxNewId();
const long wxsSettings::ID_RADIOBUTTON7 = wxNewId();

BEGIN_EVENT_TABLE( wxsSettings, cbConfigurationPanel )
END_EVENT_TABLE()

wxsSettings::wxsSettings( wxWindow* parent, M_Code_unused wxWindowID id ) {
  wxStaticText* StaticText10;
  wxBoxSizer* BoxSizer4;
  wxStaticBoxSizer* StaticBoxSizer2;
  wxStaticText* StaticText9;
  wxFlexGridSizer* FlexGridSizer4;
  wxStaticText* StaticText13;
  wxStaticText* StaticText2;
  wxStaticText* StaticText14;
  wxStaticBoxSizer* StaticBoxSizer4;
  wxFlexGridSizer* FlexGridSizer3;
  wxStaticText* StaticText6;
  wxFlexGridSizer* FlexGridSizer5;
  wxStaticText* StaticText8;
  wxStaticText* StaticText11;
  wxFlexGridSizer* FlexGridSizer2;
  wxStaticText* StaticText1;
  wxStaticText* StaticText3;
  wxFlexGridSizer* FlexGridSizer7;
  wxStaticBoxSizer* StaticBoxSizer3;
  wxStaticText* StaticText5;
  wxStaticText* StaticText7;
  wxBoxSizer* BoxSizer1;
  wxStaticText* StaticText15;
  wxStaticText* StaticText12;
  wxStaticBoxSizer* StaticBoxSizer1;
  wxFlexGridSizer* FlexGridSizer1;
  wxBoxSizer* BoxSizer3;
  wxStaticText* StaticText4;
  Create( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T( "wxID_ANY" ) );
  FlexGridSizer6 = new wxFlexGridSizer( 0, 1, 0, 0 );
  FlexGridSizer6->AddGrowableCol( 0 );
  StaticBoxSizer3 = new wxStaticBoxSizer( wxHORIZONTAL, this, _T( "资源和属性浏览器" ) );
  FlexGridSizer7 = new wxFlexGridSizer( 0, 2, 0, 0 );
  FlexGridSizer7->AddGrowableCol( 1 );
  StaticText14 = new wxStaticText( this, wxID_ANY, _T( "Unique IDs only:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer7->Add( StaticText14, 1, wxALIGN_CENTER_VERTICAL, 5 );
  m_UniqueIDsOnly = new wxCheckBox( this, ID_CHECKBOX11, _T( "(如果要将相同的ID分配给不同的小部件，请取消选中)" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX11" ) );
  m_UniqueIDsOnly->SetValue( true );
  FlexGridSizer7->Add( m_UniqueIDsOnly, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
  StaticText10 = new wxStaticText( this, wxID_ANY, _T( "安置:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer7->Add( StaticText10, 1, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_BrowserPlacements = new wxChoice( this, ID_CHOICE2, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T( "ID_CHOICE2" ) );
  m_BrowserPlacements->Append( _T( "添加内部管理窗格" ) );
  m_BrowserPlacements->Append( _T( "一个可停靠窗格（一个窗格上的两个浏览器）" ) );
  m_BrowserPlacements->Append( _T( "两个可停靠窗格（窗格上的每个浏览器）" ) );
  FlexGridSizer7->Add( m_BrowserPlacements, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  FlexGridSizer7->Add( -1, -1, 0, wxEXPAND, 5 );
  StaticText11 = new wxStaticText( this, wxID_ANY, _T( "重新启动后位置将更改" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer7->Add( StaticText11, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 );
  StaticBoxSizer3->Add( FlexGridSizer7, 1, wxTOP | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer6->Add( StaticBoxSizer3, 1, wxEXPAND, 4 );
  StaticBoxSizer1 = new wxStaticBoxSizer( wxHORIZONTAL, this, _T( "Editor" ) );
  FlexGridSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
  FlexGridSizer2->AddGrowableCol( 1 );
  StaticText2 = new wxStaticText( this, wxID_ANY, _T( "拖拽帮助类型:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText2, 0, wxALIGN_CENTER_VERTICAL, 5 );
  m_DragAssistType = new wxComboBox( this, ID_COMBOBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, wxCB_READONLY, wxDefaultValidator, _T( "ID_COMBOBOX1" ) );
  m_DragAssistType->Append( _T( "None" ) );
  m_DragAssistType->Append( _T( "Simple" ) );
  m_DragAssistType->Append( _T( "Colour Mix" ) );
  FlexGridSizer2->Add( m_DragAssistType, 1, wxLEFT | wxEXPAND, 5 );
  StaticText3 = new wxStaticText( this, wxID_ANY, _T( "拖拽 target 颜色:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText3, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_DragTargetCol = new wxButton( this, ID_BUTTON1, _T( "..." ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_BUTTON1" ) );
  FlexGridSizer2->Add( m_DragTargetCol, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText4 = new wxStaticText( this, wxID_ANY, _T( "拖拽 parent 颜色:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText4, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_DragParentCol = new wxButton( this, ID_BUTTON2, _T( "..." ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_BUTTON2" ) );
  FlexGridSizer2->Add( m_DragParentCol, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  m_UseGrid = new wxCheckBox( this, ID_CHECKBOX7, _T( "网格线对齐:" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX7" ) );
  m_UseGrid->SetValue( false );
  FlexGridSizer2->Add( m_UseGrid, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_GridSize = new wxSpinCtrl( this, ID_SPINCTRL1, _T( "8" ), wxDefaultPosition, wxDefaultSize, 0, 2, 100, 8, _T( "ID_SPINCTRL1" ) );
  m_GridSize->SetValue( _T( "8" ) );
  FlexGridSizer2->Add( m_GridSize, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText1 = new wxStaticText( this, wxID_ANY, _T( "继续添加新项目:" ), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText1, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_Continous = new wxCheckBox( this, ID_CHECKBOX9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX9" ) );
  m_Continous->SetValue( false );
  FlexGridSizer2->Add( m_Continous, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText5 = new wxStaticText( this, wxID_ANY, _T( "调色板图标大小:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText5, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 );
  FlexGridSizer3->AddGrowableCol( 0 );
  FlexGridSizer3->AddGrowableCol( 1 );
  m_Icons16 = new wxRadioButton( this, ID_RADIOBUTTON1, _T( "16x16" ), wxDefaultPosition, wxDefaultSize, wxRB_GROUP, wxDefaultValidator, _T( "ID_RADIOBUTTON1" ) );
  FlexGridSizer3->Add( m_Icons16, 1, wxEXPAND, 5 );
  m_Icons32 = new wxRadioButton( this, ID_RADIOBUTTON2, _T( "32x32" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_RADIOBUTTON2" ) );
  FlexGridSizer3->Add( m_Icons32, 1, wxLEFT | wxEXPAND, 5 );
  FlexGridSizer2->Add( FlexGridSizer3, 0, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText6 = new wxStaticText( this, wxID_ANY, _T( "工具图标大小:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer2->Add( StaticText6, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 );
  FlexGridSizer4->AddGrowableCol( 0 );
  FlexGridSizer4->AddGrowableCol( 1 );
  m_TIcons16 = new wxRadioButton( this, ID_RADIOBUTTON3, _T( "16x16" ), wxDefaultPosition, wxDefaultSize, wxRB_GROUP, wxDefaultValidator, _T( "ID_RADIOBUTTON3" ) );
  FlexGridSizer4->Add( m_TIcons16, 1, wxEXPAND, 5 );
  m_TIcons32 = new wxRadioButton( this, ID_RADIOBUTTON4, _T( "32x32" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_RADIOBUTTON4" ) );
  FlexGridSizer4->Add( m_TIcons32, 1, wxLEFT | wxEXPAND, 5 );
  FlexGridSizer2->Add( FlexGridSizer4, 1, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticBoxSizer1->Add( FlexGridSizer2, 1, wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer6->Add( StaticBoxSizer1, 1, wxEXPAND, 4 );
  StaticBoxSizer2 = new wxStaticBoxSizer( wxHORIZONTAL, this, _T( "默认尺寸设置" ) );
  FlexGridSizer5 = new wxFlexGridSizer( 0, 2, 0, 0 );
  FlexGridSizer5->AddGrowableCol( 1 );
  StaticText7 = new wxStaticText( this, wxID_ANY, _T( "比例:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer5->Add( StaticText7, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_Proportion = new wxSpinCtrl( this, ID_SPINCTRL2, _T( "0" ), wxDefaultPosition, wxDefaultSize, 0, 0, 100, 0, _T( "ID_SPINCTRL2" ) );
  m_Proportion->SetValue( _T( "0" ) );
  FlexGridSizer5->Add( m_Proportion, 0, wxLEFT | wxEXPAND, 5 );
  StaticText8 = new wxStaticText( this, wxID_ANY, _T( "边框标志:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer5->Add( StaticText8, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  BoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
  m_BorderTop = new wxCheckBox( this, ID_CHECKBOX1, _T( "顶" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX1" ) );
  m_BorderTop->SetValue( true );
  BoxSizer2->Add( m_BorderTop, 1, wxALIGN_CENTER_VERTICAL, 5 );
  m_BorderBottom = new wxCheckBox( this, ID_CHECKBOX2, _T( "底" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX2" ) );
  m_BorderBottom->SetValue( true );
  BoxSizer2->Add( m_BorderBottom, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
  m_BorderLeft = new wxCheckBox( this, ID_CHECKBOX3, _T( "左" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX3" ) );
  m_BorderLeft->SetValue( true );
  BoxSizer2->Add( m_BorderLeft, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
  m_BorderRight = new wxCheckBox( this, ID_CHECKBOX4, _T( "右" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX4" ) );
  m_BorderRight->SetValue( true );
  BoxSizer2->Add( m_BorderRight, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer5->Add( BoxSizer2, 0, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText9 = new wxStaticText( this, wxID_ANY, _T( "自动尺寸:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer5->Add( StaticText9, 1, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  BoxSizer1 = new wxBoxSizer( wxHORIZONTAL );
  m_SizeExpand = new wxCheckBox( this, ID_CHECKBOX5, _T( "展开" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX5" ) );
  m_SizeExpand->SetValue( false );
  BoxSizer1->Add( m_SizeExpand, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5 );
  m_SizeShaped = new wxCheckBox( this, ID_CHECKBOX6, _T( "形状" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX6" ) );
  m_SizeShaped->SetValue( false );
  BoxSizer1->Add( m_SizeShaped, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer5->Add( BoxSizer1, 0, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText12 = new wxStaticText( this, wxID_ANY, _T( "安置:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer5->Add( StaticText12, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  m_Placement = new wxChoice( this, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T( "ID_CHOICE1" ) );
  m_Placement->Append( _T( "Left-Top" ) );
  m_Placement->Append( _T( "Top" ) );
  m_Placement->Append( _T( "Right-Top" ) );
  m_Placement->Append( _T( "Left" ) );
  m_Placement->Append( _T( "Center" ) );
  m_Placement->Append( _T( "Right" ) );
  m_Placement->Append( _T( "Left-Bottom" ) );
  m_Placement->Append( _T( "Bottom" ) );
  m_Placement->Append( _T( "Right-Bottom" ) );
  FlexGridSizer5->Add( m_Placement, 0, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticText13 = new wxStaticText( this, wxID_ANY, _T( "边界:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer5->Add( StaticText13, 0, wxTOP | wxALIGN_CENTER_VERTICAL, 5 );
  BoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
  m_Border = new wxSpinCtrl( this, ID_SPINCTRL3, _T( "8" ), wxDefaultPosition, wxDefaultSize, 0, 0, 100, 8, _T( "ID_SPINCTRL3" ) );
  m_Border->SetValue( _T( "8" ) );
  BoxSizer3->Add( m_Border, 1, wxALIGN_TOP, 5 );
  m_BorderDU = new wxCheckBox( this, ID_CHECKBOX8, _T( "使用对话框单位" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX8" ) );
  m_BorderDU->SetValue( false );
  BoxSizer3->Add( m_BorderDU, 1, wxLEFT | wxEXPAND, 5 );
  FlexGridSizer5->Add( BoxSizer3, 0, wxTOP | wxLEFT | wxEXPAND, 5 );
  StaticBoxSizer2->Add( FlexGridSizer5, 1, wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer6->Add( StaticBoxSizer2, 1, wxEXPAND, 4 );
  StaticBoxSizer4 = new wxStaticBoxSizer( wxVERTICAL, this, _T( "其他设置" ) );
  m_RemovePrefix = new wxCheckBox( this, ID_CHECKBOX10, _T( "自动删除事件处理程序函数的变量前缀" ), wxDefaultPosition, wxSize( 323, 14 ), 0, wxDefaultValidator, _T( "ID_CHECKBOX10" ) );
  m_RemovePrefix->SetValue( false );
  StaticBoxSizer4->Add( m_RemovePrefix, 0, wxEXPAND, 5 );
  BoxSizer4 = new wxBoxSizer( wxHORIZONTAL );
  m_UseI18N = new wxCheckBox( this, ID_CHECKBOX12, _T( "Use I18N for strings" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CHECKBOX12" ) );
  m_UseI18N->SetValue( true );
  BoxSizer4->Add( m_UseI18N, 0, wxALIGN_CENTER_VERTICAL, 5 );
  FlexGridSizer1 = new wxFlexGridSizer( 0, 5, 0, 0 );
  FlexGridSizer1->AddGrowableCol( 0 );
  FlexGridSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
  StaticText15 = new wxStaticText( this, wxID_ANY, _T( "Non-I18N string:" ), wxDefaultPosition, wxDefaultSize, 0, _T( "wxID_ANY" ) );
  FlexGridSizer1->Add( StaticText15, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 );
  m_NoneI18N_T = new wxRadioButton( this, ID_RADIOBUTTON5, _T( "_T(\"\")" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_RADIOBUTTON5" ) );
  m_NoneI18N_T->SetValue( true );
  FlexGridSizer1->Add( m_NoneI18N_T, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 );
  m_NoneI18NwxT = new wxRadioButton( this, ID_RADIOBUTTON6, _T( "wxT(\"\")" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_RADIOBUTTON6" ) );
  FlexGridSizer1->Add( m_NoneI18NwxT, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 );
  m_NoneI18N = new wxRadioButton( this, ID_RADIOBUTTON7, _T( "\"\"" ), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_RADIOBUTTON7" ) );
  FlexGridSizer1->Add( m_NoneI18N, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 );
  BoxSizer4->Add( FlexGridSizer1, 1, wxLEFT | wxEXPAND, 5 );
  StaticBoxSizer4->Add( BoxSizer4, 0, wxTOP | wxEXPAND, 5 );
  FlexGridSizer6->Add( StaticBoxSizer4, 1, wxEXPAND, 5 );
  SetSizer( FlexGridSizer6 );
  FlexGridSizer6->Fit( this );
  FlexGridSizer6->SetSizeHints( this );
  Connect( ID_BUTTON1, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxsSettings::OnDragTargetColClick ) );
  Connect( ID_BUTTON2, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxsSettings::OnDragParentColClick ) );
  Connect( ID_CHECKBOX7, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( wxsSettings::OnUseGridClick ) );
  ConfigManager* cfg = Manager::Get()->GetConfigManager( _T( "wxsmith" ) );
  m_UniqueIDsOnly->SetValue( cfg->ReadBool( _T( "/uniqueids" ), true ) );
  m_InitialPlacement = cfg->ReadInt( _T( "/browserplacements" ), 0 );
  m_BrowserPlacements->SetSelection( m_InitialPlacement );
  long ColTarget = cfg->ReadInt( _T( "/dragtargetcol" ), 0x608CDFL );;
  long ColParent = cfg->ReadInt( _T( "/dragparentcol" ), 0x0D177BL );;
  m_DragAssistType->SetSelection( cfg->ReadInt( _T( "/dragassisttype" ), 2 ) );
  m_DragTargetCol->SetBackgroundColour( wxColour( ( ColTarget >> 16 ) & 0xFF, ( ColTarget >> 8 ) & 0xFF, ColTarget & 0xFF ) );
  m_DragParentCol->SetBackgroundColour( wxColour( ( ColParent >> 16 ) & 0xFF, ( ColParent >> 8 ) & 0xFF, ColParent & 0xFF ) );
  if( cfg->ReadInt( _T( "/tooliconsize" ), 32L ) == 16 ) {
    m_TIcons16->SetValue( true );
  } else {
    m_TIcons32->SetValue( true );
  }
  if( cfg->ReadInt( _T( "/paletteiconsize" ), 16L ) == 16 ) {
    m_Icons16->SetValue( true );
  } else {
    m_Icons32->SetValue( true );
  }
  int GridSize = cfg->ReadInt( _T( "/gridsize" ), 8 );
  if( GridSize > 1 ) {
    m_UseGrid->SetValue( true );
    m_GridSize->SetValue( GridSize );
  } else {
    if( GridSize < -1 ) {
      m_GridSize->SetValue( -GridSize );
    }
    m_GridSize->Disable();
  }
  m_Continous->SetValue( cfg->ReadBool( _T( "/continousinsert" ), false ) );
  m_RemovePrefix->SetValue( cfg->ReadBool( _T( "/removeprefix" ), false ) );
  m_UseI18N->SetValue( cfg->ReadBool( _T( "/useI18N" ), true ) );
  switch( cfg->ReadInt( _T( "/noneI18N" ), 0 ) ) {
    case 0:
      m_NoneI18N_T->SetValue( true );
      break;
    case 1:
      m_NoneI18NwxT->SetValue( true );
      break;
    case 2:
      m_NoneI18N->SetValue( true );
      break;
    default:
      break;
  }
  wxsSizerExtra Extra;
  m_Proportion->SetValue( Extra.Proportion );
  m_BorderLeft->SetValue( Extra.Flags & wxsSizerFlagsProperty::BorderLeft );
  m_BorderRight->SetValue( Extra.Flags & wxsSizerFlagsProperty::BorderRight );
  m_BorderTop->SetValue( Extra.Flags & wxsSizerFlagsProperty::BorderTop );
  m_BorderBottom->SetValue( Extra.Flags & wxsSizerFlagsProperty::BorderBottom );
  m_SizeExpand->SetValue( Extra.Flags & wxsSizerFlagsProperty::Expand );
  m_SizeShaped->SetValue( Extra.Flags & wxsSizerFlagsProperty::Shaped );
  if( Extra.Flags & wxsSizerFlagsProperty::AlignBottom ) {
    if( Extra.Flags & wxsSizerFlagsProperty::AlignRight ) {
      m_Placement->SetSelection( 8 );
    } else if( Extra.Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) {
      m_Placement->SetSelection( 7 );
    } else
    { m_Placement->SetSelection( 6 ); }
  } else if( Extra.Flags & wxsSizerFlagsProperty::AlignCenterVertical ) {
    if( Extra.Flags & wxsSizerFlagsProperty::AlignRight ) {
      m_Placement->SetSelection( 5 );
    } else if( Extra.Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) {
      m_Placement->SetSelection( 4 );
    } else
    { m_Placement->SetSelection( 3 ); }
  } else {
    if( Extra.Flags & wxsSizerFlagsProperty::AlignRight ) {
      m_Placement->SetSelection( 2 );
    } else if( Extra.Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) {
      m_Placement->SetSelection( 1 );
    } else
    { m_Placement->SetSelection( 0 ); }
  }
  m_Border->SetValue( Extra.Border.Value );
  m_BorderDU->SetValue( Extra.Border.DialogUnits );
}

wxsSettings::~wxsSettings() {
}

void wxsSettings::OnDragTargetColClick( M_Code_unused wxCommandEvent& event ) {
  wxColour Col = ::wxGetColourFromUser( this, m_DragTargetCol->GetBackgroundColour() );
  if( Col.Ok() ) {
    m_DragTargetCol->SetBackgroundColour( Col );
  }
}

void wxsSettings::OnDragParentColClick( M_Code_unused wxCommandEvent& event ) {
  wxColour Col = ::wxGetColourFromUser( this, m_DragParentCol->GetBackgroundColour() );
  if( Col.Ok() ) {
    m_DragParentCol->SetBackgroundColour( Col );
  }
}

void wxsSettings::OnApply() {
  wxColour ColTarget = m_DragTargetCol->GetBackgroundColour();
  wxColour ColParent = m_DragParentCol->GetBackgroundColour();
  ConfigManager* cfg = Manager::Get()->GetConfigManager( _T( "wxsmith" ) );
  cfg->Write( _T( "/uniqueids" ), ( bool )m_UniqueIDsOnly->GetValue() );
  cfg->Write( _T( "/browserplacements" ), ( int )( m_BrowserPlacements->GetSelection() ) );
  cfg->Write( _T( "/dragtargetcol" ), ( int )( ( ( ( int )ColTarget.Red() ) << 16 ) + ( ( ( long )ColTarget.Green() ) << 8 ) + ( long )ColTarget.Blue() ) );
  cfg->Write( _T( "/dragparentcol" ), ( int )( ( ( ( int )ColParent.Red() ) << 16 ) + ( ( ( long )ColParent.Green() ) << 8 ) + ( long )ColParent.Blue() ) );
  cfg->Write( _T( "/dragassisttype" ), ( int )m_DragAssistType->GetSelection() );
  cfg->Write( _T( "/paletteiconsize" ), ( int )( m_Icons16->GetValue() ? 16 : 32 ) );
  cfg->Write( _T( "/tooliconsize" ), ( int )( m_TIcons16->GetValue() ? 16 : 32 ) );
  int GridSize = m_GridSize->GetValue();
  if( GridSize < 2 ) {
    GridSize = 2;
  }
  if( m_UseGrid->GetValue() ) {
    cfg->Write( _T( "/gridsize" ), GridSize );
  } else {
    cfg->Write( _T( "/gridsize" ), -GridSize );
  }
  cfg->Write( _T( "/continousinsert" ), m_Continous->GetValue() );
  cfg->Write( _T( "/removeprefix" ), m_RemovePrefix->GetValue() );
  cfg->Write( _T( "/useI18N" ), m_UseI18N->GetValue() );
  if( m_NoneI18N_T->GetValue() ) {
    cfg->Write( _T( "/noneI18N" ), 0 );
  } else if( m_NoneI18NwxT->GetValue() ) {
    cfg->Write( _T( "/noneI18N" ), 1 );
  } else if( m_NoneI18N->GetValue() ) {
    cfg->Write( _T( "/noneI18N" ), 2 );
  }
  int Flags = ( m_BorderLeft->IsChecked() ? wxsSizerFlagsProperty::BorderLeft : 0 ) |
              ( m_BorderRight->IsChecked() ? wxsSizerFlagsProperty::BorderRight : 0 ) |
              ( m_BorderTop->IsChecked() ? wxsSizerFlagsProperty::BorderTop : 0 ) |
              ( m_BorderBottom->IsChecked() ? wxsSizerFlagsProperty::BorderBottom : 0 ) |
              ( m_SizeExpand->IsChecked() ? wxsSizerFlagsProperty::Expand : 0 ) |
              ( m_SizeShaped->IsChecked() ? wxsSizerFlagsProperty::Shaped : 0 );
  switch( m_Placement->GetSelection() ) {
    case 0:
      Flags |= wxsSizerFlagsProperty::AlignLeft | wxsSizerFlagsProperty::AlignTop;
      break;
    case 1:
      Flags |= wxsSizerFlagsProperty::AlignCenterHorizontal | wxsSizerFlagsProperty::AlignTop;
      break;
    case 2:
      Flags |= wxsSizerFlagsProperty::AlignRight | wxsSizerFlagsProperty::AlignTop;
      break;
    case 3:
      Flags |= wxsSizerFlagsProperty::AlignLeft | wxsSizerFlagsProperty::AlignCenterVertical;
      break;
    case 4:
      Flags |= wxsSizerFlagsProperty::AlignCenterHorizontal | wxsSizerFlagsProperty::AlignCenterVertical;
      break;
    case 5:
      Flags |= wxsSizerFlagsProperty::AlignRight | wxsSizerFlagsProperty::AlignCenterVertical;
      break;
    case 6:
      Flags |= wxsSizerFlagsProperty::AlignLeft | wxsSizerFlagsProperty::AlignBottom;
      break;
    case 7:
      Flags |= wxsSizerFlagsProperty::AlignCenterHorizontal | wxsSizerFlagsProperty::AlignBottom;
      break;
    case 8:
      Flags |= wxsSizerFlagsProperty::AlignRight | wxsSizerFlagsProperty::AlignBottom;
      break;
    default:
      break;
  }
  cfg->Write( _T( "/defsizer/proportion" ), ( int )m_Proportion->GetValue() );
  cfg->Write( _T( "/defsizer/flags" ),      Flags );
  cfg->Write( _T( "/defsizer/border" ), ( int )m_Border->GetValue() );
  cfg->Write( _T( "/defsizer/borderdu" ), ( bool )m_BorderDU->GetValue() );
  wxsItemEditor::ConfigChanged();
}

void wxsSettings::OnUseGridClick( M_Code_unused wxCommandEvent& event ) {
  m_GridSize->Enable( m_UseGrid->GetValue() );
}
